# @Remark:我的班级

from Common.basepage import BasePage
from PageLocators.TS.ts_myclass_loc import MyClassPageLocator as mc_loc


class TsClassPage(BasePage):
    """TS班主任工作平台我的班级"""

    # TS我的班级
    def go_my_class_nav(self):
        """打开我的班级导航页面"""
        self.click_element(mc_loc.nav_my_class_loc, "点击导航-我的班级", sleep_time=5)

    def my_class_lst(self):
        """我的班级列表数据"""
        self.click_element(mc_loc.class_status_loc, "点击我的班级-开课状态", sleep_time=2)
        self.click_element(mc_loc.finish_class_loc, "点击开课状态-已结课")
        self.click_element(mc_loc.search_loc, "我的班级-点击搜索", sleep_time=10)
        class_lst_data = self.get_element_text(mc_loc.lst_body_loc, "获取班级列表数据文本")
        return class_lst_data

    def my_class_detail(self):
        """班级详情"""
        self.click_element(mc_loc.class_name_loc, "点击20210322L1春幼儿课程学习班级", sleep_time=8)
        detail_data = dict()
        # 基本信息列表数据
        detail_data['class_info'] = self.get_element_text(mc_loc.class_info_loc, "获取基本信息列表数据文本")
        detail_data['course_lst'] = self.get_element_text(mc_loc.course_lst_loc, "获取全部课时列表数据文本")
        detail_data['student_body'] = self.get_element_text(mc_loc.lst_body_loc, "获取学员列表数据文本")
        detail_data['student_info'] = self.get_element_text(mc_loc.student_info_lst_loc, "获取当前班级学员数据文本")
        return detail_data

    def job_completion(self):
        """作业完成情况"""
        self.click_element(mc_loc.job_completion_loc, "点击作业完成情况", sleep_time=3)
        job_completion_data = self.get_element_text(mc_loc.job_completion_widow_loc, "作业完成情况弹窗数据")
        self.click_element(mc_loc.cancel_loc, "点击取消")
        return job_completion_data




